<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}

if($_POST['sub']!=''){

    $id=empty($_POST['id'])?0:(int)$_POST['id'];
	unset($_POST['id']);
	unset($_POST['sub']);
    
    if(trim($_POST['realname'])==""){
        jumpajax('300','用户姓名不能为空！','');
    }   
        
    $data=array('realname'=>$_POST['realname'],
    'carno'=>$_POST["carno"],
    "usercode"=>trim($_POST["usercode"]),
    "userid"=>$_SESSION['EZ_Admin']['id'],
    "mobile"=>$_POST["mobile"]
    );
	
 	if($id==0){
     	  
        $data["addtime"]=time();
	    $id=$ezhand->insert("senduser",$data);
		jumpajax('200','保存成功','','closeCurrent');
	}
	else{
	    $ezhand->update("senduser",$data,'id="'.$id.'"');
		jumpajax('200','修改成功','','closeCurrent');
	}
}
else{
	$id=empty($_GET['id'])?0:(int)$_GET['id'];
	
    if($id==0){
	    $row=array();
		$role_menu_arr=array();
	}
	else{
	    $row=$ezhand->select("senduser",'*','id="'.$id.'"');
	}
}
?>